import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/components/layout/layout'

// const _import = require('./_import_' + process.env.NODE_ENV)
Vue.use(Router)

export const constantRouterMap = [
  // { path: '/login', component: _import('login') },
  { path: '/login', component: resolve => require(['@/components/login'], resolve) },
  { path: '/404', component: resolve => require(['@/components/error/404'], resolve) },
  { path: '/401', component: resolve => require(['@/components/error/401'], resolve) },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: '首页',
    hidden: true,
    children: [
    { path: 'dashboard', component: resolve => require(['@/components/dashboard/index'], resolve) }]
  },
  {
    path:'/other',
    component:Layout,
    redirect:"/category",
    name:"其它",
    children:[
     {path:'category',component:resolve => require(['@/components/other/category'], resolve) },
     {path:'detail',component:resolve => require(['@/components/other/detail'], resolve) },
     {path:'articleCate',component:resolve => require(['@/components/other/articleCate'], resolve) },
     {path:'article',component:resolve => require(['@/components/other/article'], resolve) },
     {path:'default',component:resolve => require(['@/components/other/default'], resolve) },
     {path:'cart',component:resolve => require(['@/components/other/cart'], resolve) },
     {path:'checkout',component:resolve => require(['@/components/other/checkout'], resolve) },
     {path:'alert',component:resolve => require(['@/components/other/alert'], resolve) },
     {path:'success',component:resolve => require(['@/components/other/success'], resolve) },
    ]
  }
]
export default new Router({
  routes: constantRouterMap
})
